ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
GUI_State.c File Reference

State used to send and receive data from demo GUI. More...

#include "derivative.h"
#include "Compile_Options.h"
#include "GUI_State.h"
#include "SM.h"
#include "SBC_AL.h"
#include "CG147.h"
#include "CG147_Diag.h"
#include "Central_Accel_AL.h"
#include "MMA68xx.h"
#include "MMA68xx_Diag.h"
#include "DSPI.h"
#include "HAL.h"
#include "MailScheduler.h"
#include "Application_Globals.h"
#include "MMA51xx.h"
#include "SIU.h"
#include "Labview.h"
#include "IntcInterrupts.h"
#include "Utils.h"
#include "LIN_UART.h"
#include <Limits.h>

Functions

uint32_t u32fnStateGUI (void)
 Demo mode GUI state takes over diagnostics state.
void vfnGUIStateFormatCurveData (uint16_t *au16LabviewData)
 This function takes data from gau16RawAccels and formats it into a Labview-friendly format.
uint32_t u32fnGUISwitchCase (const uint8_t *pu8Cmd, uint8_t *pu8RawResponse, uint8_t *pu8Size, uint8_t *pu8TextResponse, uint8_t *pu8TextSize)
 Used to select which command will be executed, based on the incoming message.
uint32_t u32fnGUISendResponseFrame (const uint8_t *pu8Cmd, const uint8_t *pu8RawResponse, const uint8_t *pu8Size, const uint8_t *pu8TextResponse, const uint8_t u8TextSize)
 After the raw response is ready, this function formats it into the correct format and sends it over to the GUI.
void vfnGUISBCCapTests (uint8_t *pu8Size, uint8_t *pu8RawResponse, uint8_t u8ERx, uint8_t u8Test)
 Performs Cap tests as requested by the GUI.
void vfnGUISBCLeakageTests (const uint8_t cu8Side, const uint8_t cu8Squib, const uint8_t cu8LeakageType, uint8_t *pu8Result)
 Performs a specific leakage or resistance tests (squibs).
void vfnGUICheckSatellites (const uint16_t *pu16Mask, uint8_t *pu8Result)
 Verifies that satellites have started up correctly by restarting them.
void vfnVerifyValidityOfCmd (const uint8_t *pu8Cmd, const GUICmdString_t *ptValidCmd, const uint16_t u16TableSize, uint8_t *pu8Result)
 Verifies that a given command is in the list of approved commands (catGUIValidCommands). This function is directly linked to command '1'.
void vfnGUISatAndSquibState (const uint8_t u8Mode, const uint16_t cu16Step)
 Used to send to GUI a verbose list of active satellites and squibs Due to time constrains, this function is broken into n subsections or threads.

Detailed Description

State used to send and receive data from demo GUI.

Copyright (C) 2011 Freescale Semiconductor Freescale Confidential Proprietary

Author:
Freescale Semiconductor
SASD Automotive
r11515
Version:
Date:
Warning:
(If needed)

History:


Function Documentation

uint32_t u32fnGUISendResponseFrame ( const uint8_t *  pu8Cmd,
const uint8_t *  pu8RawResponse,
const uint8_t *  pu8Size,
const uint8_t *  pu8TextResponse,
const uint8_t  u8TextSize 
)

After the raw response is ready, this function formats it into the correct format and sends it over to the GUI.

Parameters:
pu8Cmd,:pointer to the command and arguments used for the previous response.
pu8RawResponse,:Pointer to memory location where the response is to be stored. First element must be either '00' or '01' for passed or failed, and the next locations should contain data.
pu8Size,:Pointer to location where the size of the raw response is stored.
pu8TextResponse,:Pointer to memory location where a text message is stored. It will be sent as status.
u8TextSize,:Size for TextResponse.
Returns:
u32Status.
uint32_t u32fnGUISwitchCase ( const uint8_t *  pu8Cmd,
uint8_t *  pu8RawResponse,
uint8_t *  pu8Size,
uint8_t *  pu8TextResponse,
uint8_t *  pu8TextSize 
)

Used to select which command will be executed, based on the incoming message.

Parameters:
pu8Cmd,:Pointer to command and arguments structure.
pu8RawResponse,:Pointer to memory location where the response is to be stored. First element must be either '01' or '00' for passed or failed, and the next locations should contain data.
pu8Size,:Pointer to location where the size of the raw response will be stored.
pu8TextResponse,:Pointer to memory location where a text message will be stored to be sent to GUI as status.
pu8TextSize,:Pointer to location where the size for the status message size will be stored.
Returns:
u32Status from whatever function was called, if any.
uint32_t u32fnStateGUI ( void  )

Demo mode GUI state takes over diagnostics state.

Parameters:
Void.
Returns:
u32Status: Clear if it is a valid source; SM_STATE_IS_EXECUTING if this state was entered while another one was already executing; SM_INVALID_SOURCE_STATE if the source state is not in the pu16ValidStateList; other error codes are also possible.
void vfnGUICheckSatellites ( const uint16_t *  pu16Mask,
uint8_t *  pu8Result 
)

Verifies that satellites have started up correctly by restarting them.

Parameters:
pu16Mask,:Pointer to mask list with all satellites to be tested.
pu8Result,:Pointer to memory location where the response is to be stored. First element must be either TRUE or CLEAR for passed or failed, and the next locations should contain data.
Returns:
Void.
Warning:
This routine must reset the SBC. This operation is limited to three times after a POR by the SBC itself.
void vfnGUISatAndSquibState ( const uint8_t  u8Mode,
const uint16_t  cu16Step 
)

Used to send to GUI a verbose list of active satellites and squibs Due to time constrains, this function is broken into n subsections or threads.

Parameters:
u8Mode,:Selects between parallel or serial transfer of info.
cu16Step,:Execution step.
Returns:
Void.
void vfnGUISBCCapTests ( uint8_t *  pu8Size,
uint8_t *  pu8RawResponse,
uint8_t  u8ERx,
uint8_t  u8Test 
)

Performs Cap tests as requested by the GUI.

Parameters:
pu8Size,:Pointer to location where the size of the raw response is stored.
pu8RawResponse,:Pointer to memory location where the response is to be stored. First element must be either '00' or '01' for passed or failed, and the next locations should contain data.
u8ERx,:Defines which ERx to perform the test on.
u8Test,:Test index according to cau8SBCTests.
Returns:
Void.
void vfnGUISBCLeakageTests ( const uint8_t  cu8Side,
const uint8_t  cu8Squib,
const uint8_t  cu8LeakageType,
uint8_t *  pu8Result 
)

Performs a specific leakage or resistance tests (squibs).

Parameters:
cu8Side,:low (TRUE) or high (CLEAR) side
cu8Squib,:Any valid squib index, from 0 - 11.
cu8LeakageType,:Low leakage (TRUE) or high leakage (CLEAR).
pu8Result,:Pointer to memory location where the response is to be stored. First element must be either TRUE or CLEAR for passed or failed, and the next locations should contain data.
Returns:
Void.
void vfnGUIStateFormatCurveData ( uint16_t *  au16LabviewData)

This function takes data from gau16RawAccels and formats it into a Labview-friendly format.

Parameters:
au16LabviewData,:Pointer to the location where the Labview array should be placed.
Returns:
Void.
void vfnVerifyValidityOfCmd ( const uint8_t *  pu8Cmd,
const GUICmdString_t ptValidCmd,
const uint16_t  u16TableSize,
uint8_t *  pu8Result 
)

Verifies that a given command is in the list of approved commands (catGUIValidCommands). This function is directly linked to command '1'.

Parameters:
pu8Cmd,:Pointer to commands and arguments.
ptValidCmd,:Pointer to the list of valid commands and arguments.
u16TableSize,:Number of elements in ptValidCmd
pu8Result,:Pointer to memory location where the response is to be stored. First element must be either TRUE or CLEAR for passed or failed.
Returns:
Void.